/*
 * This file is part of algowala.
 *
 * algowala is copyright (c) 2012 Jagannathan Sampath <algowala@jagernot.com>
 *
 * algowala is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * algowala is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with algowala.  If not, see <http://www.gnu.org/licenses/>.
 *
*/
#ifndef __tcp_server
#define __tcp_server

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <queue>
#include <string>
#include "server.h"

struct tcp_server : server { // TCP server

  int sock; // socket that sends & recvs data
  int port; // port at which clients dock

  std::vector<int> connections; // array of connections
      
  tcp_server (int _port); // setup server
  void start (); // starts the server
  void stop (); // stops server & clean up

  pthread_t thrd; // server thread
  static void* run (void* arg); // thread callback
  static int quit_thread; // quit server thread?

  
};

#endif
